<%
var headContent = {
include("/pages/template/head.html"){}
%>

<script type="text/javascript">
    var oper;
    jQuery(function($) {
        // 页面方法
        oper = {
            width : 450,
            height : 500,
            form : document.form1,
            list : function() {
                var url = 'system/providerinfo/list';
                this.form.action = url;
                this.form.submit();
            },
            view : function(id) {
                var url = 'system/providerinfo/view/'+id;
                var title = '查看供应商';
                Iframe(url, this.width, this.height, title, false, false, false, EmptyFunc);
            },
            add : function() {
                var url = 'system/providerinfo/add';
                var title = '添加供应商';
                Iframe(url, this.width, this.height, title);
            },
            edit : function(id) {
                var url = 'system/providerinfo/edit/'+id;
                var title = '修改供应商';
                Iframe(url, this.width, this.height, title);
            },
            del : function(id,delFlag,providerName) {
                var url = 'system/providerinfo/delete/'+id+'?delFlag='+delFlag;
                var title = "";
                if("0" ==delFlag){
                	title = '<span  class ="font-danger">确认要删除该供应商&lt;'+providerName+' &gt;吗?</span>';
                }else{
                	title = '<span  class ="font-success">确认要恢复该供应商&lt;'+providerName+'&gt;吗?</span>';
                }
                Confirm(title, function() {
                    form1.action = url;
                    form1.submit();
                });
            }
        };
        //显示Menu索引
        showMenu('page_system');
        showMenu('page_providerinfo');
    });

    //分页
    var paginator = function(page) {
        oper.list();
    };

</script>

<%
};

var bodyContent = {
%>
<form name="form1" action="" method="post"  class="form-inline" role="form">
	<!-- 菜单 -->
	<% include("/pages/template/menu.html"){} %>

	<div class="tableSearch">
		<%  //查询列表 %>
		<div class="form-group">
		 	<select name="attr.delFlag" class="form-control" style = "width:196px" >
				<option value="">请选择数据状态</option>
				<option value="0" ${attr.delFlag=="0"?"selected":"" }>正常</option>
				<option value="1" ${attr.delFlag=="1"?"selected":"" }>删除</option>
			</select>
		</div>
		<div class="form-group">
			<input class="form-control" type="text" name="attr.channel" value="${attr.channel!''}"
				   placeholder="请输入渠道名称" required='required' />
		</div>
		<div class="form-group">
				<select name="attr.ids" class="form-control" style = "width:196px" >
				<option value="">请选择供应商</option>
				${selectProvider }
				</select>
		</div>

		<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
			<span class="glyphicon glyphicon-search"></span> 查 询
		</button>
		<button type="button" class="btn btn-default" onclick="resetForm();">
			<span class="glyphicon glyphicon-refresh"></span> 重 置
		</button>
		<button type="button" class="btn btn-default" onclick="oper.add();">
			<span class="glyphicon glyphicon-plus"></span> 新 增
		</button>
	</div>

	<!-- 数据列表 -->
	<table class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th>序号</th>
			<%  // 列表头部 %>
			<th style="display:none" name="ids" class="sorting">ids</th>
			<th name="providerName" class="sorting">供应商名称</th>
			<th name="channel" class="sorting">供应商渠道</th>
			<th name="providerDesc" class="sorting">供应商描述</th>
			<th name="delFlag" class="sorting">状态</th>
			<th name="delFlag" class="sorting">数据状态</th>
			<th name="isCache" class="sorting">缓存开关</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody>
		<% for(item in page.list){ %>
		<tr>
			<td>${itemLP.index }</td>
			<%  // 列表内容 %>
			<td>${item.providerName}</td>
			<td>${item.channel}</td>
			<td>${item.providerDesc}</td>
			<td>
				<% if(item.status=="1") { %>
				<span class ="font-danger">失效</span>
				<%	} %>
				<% if(item.status=="0") { %>
				<span class ="font-success">有效</span>
				<%	} %>
			</td>
			<td>
				<% if(item.delFlag=="1") { %>
				<span class ="font-danger">删除</span>
				<%	} %>
				<% if(item.delFlag=="0") { %>
				<span class ="font-success">正常</span>
				<%	} %>
			</td>
			<td>
				<% if(item.isCache=="1") { %>
				否 
				<%	} %>
				<% if(item.isCache=="0") { %>
				是
				<%	} %>
			</td>
			<td>
				<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view('${item.ids}');">查看</a>
				<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit('${item.ids}');">修改</a>
				
					<% if(item.delFlag=="1") { %>
				<a href="javascript:void(0);" class="btn btn-sm btn-info" onclick="oper.del('${item.ids}','${item.delFlag}','${item.providerName}');">恢复</a>
				<%	} %>
				<% if(item.delFlag=="0") { %>
				<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del('${item.ids}','${item.delFlag}','${item.providerName}');">删除</a>
				<%	} %>

				
			</td>
		</tr>
		<% } %>
		</tbody>
	</table>
	<%include("/pages/includes/paginator.html"){} %>
</form>
<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>